package com.project.dao.impl;

import com.project.common.util.MD5Util;
import com.project.dao.IDaoCustomer;
import com.project.webapp.form.front.LoginForm;
import com.project.webapp.form.front.RegisterForm;

public class DaoCustomerImpl extends BaseDaoImpl implements IDaoCustomer {

    @Override
    public boolean validLoginCustomer(LoginForm loginForm) throws Exception {
        boolean flag = false;
        Integer cnt = (Integer) this.getSqlMapClient().queryForObject("validLoginCustomer",
            loginForm);
        if (cnt > 0) {
            flag = true;
        }
        return flag;
    }

    @Override
    public boolean saveCustomer(RegisterForm registerForm) throws Exception {
    	System.out.println("接受到的密码。。"+registerForm.getCustomer().getCust_pwd());
        String cust_pwd = MD5Util.MD5(registerForm.getCustomer().getCust_pwd());
        registerForm.getCustomer().setCust_pwd(cust_pwd);
        this.getSqlMapClient().insert("saveCustomer", registerForm);
        return false;
    }

}
